#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
#include "graphviz_show.h"
using namespace std;

namespace GRAPHVIZ
{
	void testGrapViz()
	{
		stringstream ss;
		ss << "digraph graphname" << ( rand() % 1000 ) << "{" << endl
			<< "    node [shape = record ,height = .1];" << endl;
		int n = 20;
		for ( int i = 1; i<=n ; i++ )
		{
			ss<<"node"<<i<<"[label = \" <f0>|<f1>"<<i<<"|<f2>\"];"<<endl
				<<"\"node"<<i<<"\":f"<<rand()%3<<" -> \"node"<<rand()%n<<"\":f"<<rand()%3<<";"<<endl
				<<"\"node"<<i<<"\":f"<<rand()%3<<" -> \"node"<<rand()%n<<"\":f"<<rand()%3<<";"<<endl;
		}
		ss << "}" << endl;
		string ssOut;
		ss>>ssOut;
		cout<<ss.str();
		ShowGraphvizViaDot( ss.str() );
	}
}